import axios from 'axios'

const request = axios.create({
  // baseURL:
  //   process.env.NODE_ENV === 'development'
  //     ? 'http://43.136.21.48:3000/:3000/api'
  //     : 'http://ihrm-java.itheima.net/api'
  baseURL: process.env.VUE_APP_URL
})

// 请求拦截器
request.interceptors.request.use(
  (config) => {
    return config
  },
  (error) => {
    return Promise.reject(error)
  }
)

// 响应拦截器
request.interceptors.response.use(
  (res) => {
    return res.data
  },
  (error) => {
    return Promise.reject(error)
  }
)

export default request
